package com.azthink.chaper411.configuration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

//声明TestConfiguration类是配置类
@Configuration
public class TestConfiguration {

    public TestConfiguration(){
        System.out.println("TestConfiguration容器启动初始化。。。");
    }


    // @Bean注解注册bean,同时可以指定初始化和销毁方法
     @Bean(name="testBean",initMethod="start",destroyMethod="cleanUp")
    //@Bean(name = "aaa")
    @Scope("singleton")
    public TestBean testBean() {
        return new TestBean();
    }




}
